<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <input type="button" value="全选" onclick="CheckAll()">
    <input type="button" value="取消" onclick="CancleALL()">
    <input type="button" value="反选" onclick="ReverseALL()">


    <table  border="1">
        <thead>
          <tr>
              <th>序号</th>
              <th>用户名</th>
              <th>密码</th>
          </tr>

        </thead>

        <tbody id="tb">
            <tr>
                <td><input type="checkbox"></td>
                <td>11</td>
                <td>111</td>
            </tr>

            <tr>
                <td><input type="checkbox"></td>
                <td>22</td>
                <td>222</td>
            </tr>

            <tr>
                <td><input type="checkbox"></td>
                <td>33</td>
                <td>333</td>
            </tr>
        </tbody>
    </table>
    <script src="jquery-3.5.0.js"></script>
    <script>
        function CheckAll() {
            $('#tb input[type="checkbox"]').prop('checked',true)

        }

        function CancleALL() {
            $('#tb input[type="checkbox"]').prop('checked',false)
        }

        function ReverseALL() {
            $('#tb input[type="checkbox"]').each(function (i) {
                //this  代表当前对象
                //$(this) 代表当前对象的jQuery对象
                if($(this).prop('checked')){$(this).prop('checked',false)}
                else{$(this).prop('checked',true)}
            })
        }
    </script>
</body>
</html>